package com.md.facade;

import com.md.api.AppInfoApi;
import com.md.application.service.AppInfoApplicationService;
import com.md.config.Logs;
import com.md.model.page.PageResponse;
import com.md.model.system.CommonResult;
import com.md.request.AppInfoRequest;
import com.md.request.LinkModuleRequest;
import com.md.request.QueryAppInfoRequest;
import com.md.response.AppInfoResponse;
import com.md.value.enums.OperationEnum;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 刘骄阳
 * 2024-07-14 22:16
 */
@RestController
@RequiredArgsConstructor
public class AppInfoController implements AppInfoApi {
  private final AppInfoApplicationService appInfoApplicationService;

  @Override
  @Logs(title = "查询应用信息详情", operation = OperationEnum.SELECT)
  public CommonResult<AppInfoResponse> query(final QueryAppInfoRequest request) {
    return appInfoApplicationService.query(request);
  }

  @Override
  @Logs(title = "批量查询应用信息", operation = OperationEnum.SELECT)
  public CommonResult<PageResponse<AppInfoResponse>> queryList(final QueryAppInfoRequest request) {
    return appInfoApplicationService.queryList(request);
  }

  @Override
  @Logs(title = "创建应用信息", operation = OperationEnum.INSERT)
  public CommonResult<AppInfoResponse> create(final AppInfoRequest request) {
    return appInfoApplicationService.create(request);
  }

  @Override
  @Logs(title = "更新应用信息", operation = OperationEnum.UPDATE)
  public CommonResult<AppInfoResponse> update(final AppInfoRequest request) {
    return appInfoApplicationService.update(request);
  }

  @Override
  @Logs(title = "关联应用与模块", operation = OperationEnum.UPDATE)
  public CommonResult<Void> linkModule(final LinkModuleRequest request) {
    return appInfoApplicationService.linkModule(request);
  }
}
